package com.example.edu.controller.frontController;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.edu.entity.Course;
import com.example.edu.entity.Teacher;
import com.example.edu.service.CourseService;
import com.example.edu.service.TeacherService;
import com.example.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/edu")
public class FrontController {
    @Autowired
    TeacherService teacherService;
    @Autowired
    CourseService courseService;

    @GetMapping("getTeacherAndCourse")
    public Result getTeacherAndCourse(){

        List<Course> courseList = courseService.selectAllCourse();

        List<Teacher> teacherList = teacherService.selectAllTeacher();

        return Result.ok().data("courseList",courseList).data("teacherList",teacherList);
    }
}
